package qingke.pojo;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="order1")
public class Order {

	@Id
	@Column(name = "id")
	private int id;
	@Column(name = "create_datetime")
	private String createDatetime;
	@Column(name = "memo")
	private String memo;

	@OneToMany
	@JoinColumn(name = "order1_id")
	private Set<Payment> payment;
	
	@OneToMany
	@JoinColumn(name = "order1_id")
	private Set<OrderItem> orderItem;
	
	@ManyToOne
	@JoinColumn(name = "client_id")
	private Client client;
	
	public Order(){
		
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getCreateDatetime() {
		return createDatetime;
	}

	public void setCreateDatetime(String createDatetime) {
		this.createDatetime = createDatetime;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

//	public Set<Payment> getPayment() {
//		return payment;
//	}
//
//	public void setPayment(Set<Payment> payment) {
//		this.payment = payment;
//	}

	public Set<OrderItem> getOrderItem() {
		return orderItem;
	}

	public void setOrderItem(Set<OrderItem> orderItem) {
		this.orderItem = orderItem;
	}

	public Client getClient() {
		return client;
	}

	public void setClient(Client client) {
		this.client = client;
	}

	
	public String toString1() {
		return "Order [id=" + id + ", createDatetime=" + createDatetime + ", memo=" + memo + "]";
	}
	
	public String toString() {
		return "Order [id=" + id + ", createDatetime=" + createDatetime + ", memo=" + memo +orderItem.toString()+ "]";
	}
	
}
